<template>
  <view class="loading-container" v-if="show">
    <view class="loading-spinner">
      <view class="spinner"></view>
    </view>
    <text class="loading-text">{{text}}</text>
  </view>
</template>

<script>
export default {
  name: 'LoadingSpinner',
  props: {
    show: {
      type: Boolean,
      default: false
    },
    text: {
      type: String,
      default: '加载中...'
    }
  }
}
</script>

<style lang="scss">
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  .loading-spinner {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;

    .spinner {
      width: 100%;
      height: 100%;
      border: 3px solid rgba(255, 255, 255, 0.3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
  }

  .loading-text {
    color: #fff;
    font-size: 14px;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
</style>